<h1>Unplugged Framework for Windows 8.1 Store Apps</h1>

<p>This repository contains the source code for the Unplugged framework. See the Documentation tab for a more details on how to use this framework.</p>

<h2>Overview</h2>

<p>Mobile apps being able to work offline has become an expected feature of almost all mobile/tablet applications. For data-driven applications, it means that developers will have to store user-specific application data locally, and implement a data synchronization mechanism that keeps the local and server data in sync. By incorporating the Unplugged framework into your code, you can extend your Windows 8.1 Applications to download unstructured data and still function when disconnected from the network. 
This documentation describes the design and features of this framework that you can incorporate into Windows Store applications. </p>

<h2>Setup</h2>

<h3>Software Requirements</h3>

<p>To work with the occasionally connected application framework, you must ensure that your system meets the following minimum software requirements:</p>

<ol>
<li>Windows 8.1 Operating System</li>
<li>Visual Studio 2013</li>
<li>3rd Party libraries &amp; additional references (set Visual Studio to download required Nuget packages)
<ol>
<li>SQLite.dll 3.8.4 - Download and install the SQLite Visual Studio extension for Windows 8.1: <a href="http://www.sqlite.org/2014/sqlite-winrt81-3080400.vsix">http://www.sqlite.org/2014/sqlite-winrt81-3080400.vsix</a></li>
<li>Packages installed via Nuget. This will happen automatically if you have the package manager set up to download dependencies.
<ul>
<li><a href="https://www.nuget.org/packages/MvvmLight/">MVVMLight 4.2.30.0</a></li>
<li><a href="https://www.nuget.org/packages/WindowsAzure.MobileServices/1.0.3">Windows Azure Mobile Services 1.0.3</a></li>
<li><a href="https://www.nuget.org/packages/sqlite-net/">Sqlite-net 1.0.8</a></li>
<li><a href="https://www.nuget.org/packages/WindowsAzure.Storage-Preview/2.1.0.4-preview">Windows Azure Storage-Preview 2.1.0.3-preview (Win 8.1 version is still in CTP)</a></li>
</ul></li>
</ol></li>
</ol>

<h3>Remote Server Setup</h3>

<p>In this example, the remote server is responsible for</p>

<ol>
<li>Providing a SAS for access to your blob storage account</li>
<li>Linking the users device to the blob storage account for that user</li>
<li>Offloading file upload/download directly to the blob storage service</li>
</ol>

<p>It could be expanded to support distributing users across multiple storage accounts, provide read-only privileges to specific containers, or complete user validation prior to providing a SAS key.</p>

<p>We have included a sample project (TED.WindowsAzure.Unplugged.Mobile.RemoteStorage.AzureBlob) in the toolkit which will help you build a remote file server functionality using Windows Azure blob storage and Mobile Services. If you prefer to use a WebAPI server, you can easily rewrite this script using C# and update WindowsAzureBlobStorage accordingly to call the new API.</p>

<p>In our example we have remote containers of blobs in Windows Azure. We've defined a Windows Azure storage account and secure key in a script running windows Azure Mobile Services. You will need to update the script and keys in the source code with your own windows Azure storage account information.</p>

<p>The script is included in the Script directory of the TED.WindowsAzure.Unplugged.Mobile.RemoteStorage.AzureBlob project</p>

<p><img src="Download/SourceControlFileDownload.ashx?ProjectName=unplugged&amp;changeSetId=5442e7b63b6e9d3fb845a638a25f8ee176ba3965&amp;itemId=OCAF%2fTED.WindowsAzure.Unplugged.Mobile%2f_Documentation%2fmobileservicesapi.png" alt="Mobile Services Script Location"></p>

<p>You will need to add this script to Windows Azure Mobile Services before the remote storage implementation will work.</p>

<p><img src="Download/SourceControlFileDownload.ashx?ProjectName=unplugged&amp;changeSetId=5442e7b63b6e9d3fb845a638a25f8ee176ba3965&amp;itemId=OCAF%2fTED.WindowsAzure.Unplugged.Mobile%2f_Documentation%2fmobileservicesapiportal.png" alt="Mobile Services Script in Portal"></p>
